<template>
  <div class="app-container">
    <input v-model="inputVal" type="text" class="form-control" placeholder="请输入" />
    <button @click="handleAdd">点我</button>
  </div>
</template>

<script setup>
import { ref  } from 'vue';
const list = ref(['JavaScript', 'HTML', 'CSS'])
const inputVal = ref('');


// add 触发后的事件处理函数
const handleAdd = () => {
  list.value.push(inputVal.value)
  inputVal.value = ''
}
defineExpose({ list })
</script>

<style lang="scss" scoped>
</style>